# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Christian Hesse <mail@eworm.de>
# Contributor: Daenyth <Daenyth+Arch [at] gmail [dot] com>
# Contributor: nofxx <x@nofxx.com>

pkgname=iodine
pkgver=0.8.0
pkgrel=1
pkgdesc='Tunnel IPv4 data through a DNS server'
arch=('loong64' 'x86_64')
url='https://code.kryo.se/iodine'
license=('custom:ISC')
depends=('zlib' 'net-tools' 'systemd-libs')
backup=('etc/conf.d/iodined')
source=("https://code.kryo.se/$pkgname/$pkgname-$pkgver.tar.gz"
        'iodined.service'
        'iodined.conf.d')
sha512sums=('26d0d4fd1a8ed1854fc3f2478e91e9702732a11dda30aae21e3098630e110d8316e08df581bf0083d91ca7ea3433856827d5b1031e02f9fd25217778361ec6e5'
            '9dcc2540d12b98befab4f2695fd8ff3afe9dc6f52868826ac2997cc078b8152c1c7e8918a4daa3d3035e205a0c27062f5a422c46eb9763ebbc8824ea03a926c5'
            '07c4733b98287672fe98bdb8d666672994aa675d1bbde58d342471e318f1a7b5fc2f66cb8d068a1a4ef5697647608a217eb1949dfbd5b672b4d8982f09e902aa')

build() {
  cd $pkgname-$pkgver
  make
}

package() {
  cd $pkgname-$pkgver

  make prefix=/usr sbindir=/usr/bin DESTDIR="$pkgdir" install
  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/iodine/

  install -Dm644 "$srcdir/iodined.service" -t "$pkgdir"/usr/lib/systemd/system/
  install -Dm644 doc/iodine-server.socket "$pkgdir"/usr/lib/systemd/system/iodined.socket
  install -Dm644 "$srcdir/iodined.conf.d" "$pkgdir/etc/conf.d/iodined"
}
